//-----------------------------------------------------------------------
// <copyright file="GiftService.cs" company="FetCo">
//     Copyright (c) FetCo. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using FetCo.Framework;
using ADESSA.Entities;
using ADESSA.Data;
    
namespace ADESSA.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class GiftService
    {
        #region Gift

        public static void CreateGift(Gift gift)
        {            
            try
            {
                GiftDAO giftDAO = new GiftDAO();
                giftDAO.CreateGift(gift);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessCreateGiftException, ex);
            }
        }        

        public static void UpdateGift(Gift gift)
        {            
            try
            {
                GiftDAO giftDAO = new GiftDAO();
                giftDAO.UpdateGift(gift);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessUpdateGiftException, ex);
            }
        }        

        public static void DeleteGift(long giftId)
        {            
            try
            {
                GiftDAO giftDAO = new GiftDAO();
                giftDAO.DeleteGift(giftId);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessDeleteGiftException, ex);
            }
        }
        
        public static Gift GetGift(long giftId)
        {            
            try
            {
                GiftDAO giftDAO = new GiftDAO();
                return giftDAO.GetGift(giftId);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetGiftException, ex);
            }
        }                

        public static GiftCollection GetGiftList(GiftColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                GiftDAO giftDAO = new GiftDAO();
                return giftDAO.GetGiftList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetGiftListException, ex);
            }
        }        

        public static GiftCollection GetGiftList(GiftColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                GiftDAO giftDAO = new GiftDAO();
                return giftDAO.GetGiftList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetGiftListException, ex);
            }
        }        

	    public static GiftCollection GetGiftListByParam(object orderBy, OrderDirection orderDirection,string where)
        {            
            try
            {
                GiftDAO giftDAO = new GiftDAO();
                return giftDAO.GetGiftListByParam(orderBy, orderDirection,where);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetGiftListException, ex);
            }
        }        

        public static GiftCollection GetGiftListByParam(object orderBy, OrderDirection orderDirection, int page, int pageSize,string Criteria, out int totalRecords)
        {            
            try
            {
                GiftDAO giftDAO = new GiftDAO();
                return giftDAO.GetGiftListByParam(orderBy, orderDirection, page, pageSize,Criteria, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetGiftListException, ex);
            }
        }        

        #endregion
    }
}